package com.qf.controller;

import com.qf.dao.GoodsClassiftRepository;
import com.qf.pojo.entity.GoodsClassify;
import com.qf.pojo.req.GoodsClassifyReq;
import com.qf.pojo.resp.BaseResp;
import com.qf.service.GoodsClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName GoodsClassifyController
 * @Description TODO
 * @Author Windy
 * @Date 2022/10/5 15:26
 * @Version 1.0
 **/
@RestController
@RequestMapping("gc")
@Api(tags = "店铺商品分类管理")
public class GoodsClassifyController {
    @Autowired
    GoodsClassifyService goodsClassifyService;


    @GetMapping("delegc")
    @ApiOperation(value = "通过店铺id和分类id删除店铺中的分类")
    public BaseResp deletegoodsClassify(int id,int storeId){
        System.out.println(id);
        System.out.println(storeId);
        return goodsClassifyService.deletegoodsClassify(id,storeId);
    }

    @PostMapping("updategc")
    @ApiOperation(value = "添加和修改店铺商品分类")
    public BaseResp updateGoodsClassify(@RequestBody GoodsClassifyReq goodsClassifyReq){
        return goodsClassifyService.updateAndAdd(goodsClassifyReq);
    }
}
